package com.fyt.recover;

import java.util.*;
import java.math.BigDecimal;
import java.math.RoundingMode;

public class Main {
    static class Point {
        double x, y;
        Point(double x, double y) {
            this.x = x;
            this.y = y;
        }
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int T = scanner.nextInt();
        for (int t = 0; t < T; t++) {
            double x1 = scanner.nextDouble();
            double y1 = scanner.nextDouble();
            double x2 = scanner.nextDouble();
            double y2 = scanner.nextDouble();

            double dx = x2 - x1;
            double dy = y2 - y1;

            double cos60 = 0.5;
            double sin60 = Math.sqrt(3) / 2;

            // 计算两个解的坐标
            Point p1 = new Point(
                    x1 + (dx * cos60 - dy * sin60),
                    y1 + (dx * sin60 + dy * cos60)
            );
            Point p2 = new Point(
                    x1 + (dx * cos60 + dy * sin60),
                    y1 + (-dx * sin60 + dy * cos60)
            );

            List<Point> points = new ArrayList<>(Arrays.asList(p1, p2));

            // 按四舍五入后的坐标排序
            points.sort((a, b) -> {
                BigDecimal ax = new BigDecimal(a.x).setScale(2, RoundingMode.HALF_UP);
                BigDecimal bx = new BigDecimal(b.x).setScale(2, RoundingMode.HALF_UP);
                int cmp = ax.compareTo(bx);
                if (cmp != 0) return cmp;
                BigDecimal ay = new BigDecimal(a.y).setScale(2, RoundingMode.HALF_UP);
                BigDecimal by = new BigDecimal(b.y).setScale(2, RoundingMode.HALF_UP);
                return ay.compareTo(by);
            });

            // 格式化输出并处理-0.00
            System.out.printf("%s %s%n",
                    formatPoint(points.get(0)),
                    formatPoint(points.get(1))
            );
        }
        scanner.close();
    }

    private static String formatPoint(Point p) {
        String x = String.format("%.2f", p.x).replaceAll("^-0.00$", "0.00");
        String y = String.format("%.2f", p.y).replaceAll("^-0.00$", "0.00");
        return x + " " + y;
    }
}